3.221 \(\int \frac {\cot ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx\)

Optimal. Leaf size=64 \[ \frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{a^{3/2} f (a-b)}-\frac {x}{a-b}-\frac {\cot (e+f x)}{a f} \]

[Out]

-x/(a-b)+b^(3/2)*arctan(b^(1/2)*tan(f*x+e)/a^(1/2))/a^(3/2)/(a-b)/f-cot(f*x+e)/a/f

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 64, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3670, 480, 522, 203, 205} \[ \frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{a^{3/2} f (a-b)}-\frac {x}{a-b}-\frac {\cot (e+f x)}{a f} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]^2/(a + b*Tan[e + f*x]^2),x]

[Out]

-(x/(a - b)) + (b^(3/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]])/(a^(3/2)*(a - b)*f) - Cot[e + f*x]/(a*f)

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 480

Int[((e_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Simp[((e*x)^(m
 + 1)*(a + b*x^n)^(p + 1)*(c + d*x^n)^(q + 1))/(a*c*e*(m + 1)), x] - Dist[1/(a*c*e^n*(m + 1)), Int[(e*x)^(m +
n)*(a + b*x^n)^p*(c + d*x^n)^q*Simp[(b*c + a*d)*(m + n + 1) + n*(b*c*p + a*d*q) + b*d*(m + n*(p + q + 2) + 1)*
x^n, x], x], x] /; FreeQ[{a, b, c, d, e, p, q}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[m, -1] && IntBino
mialQ[a, b, c, d, e, m, n, p, q, x]

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps

\begin {align*} \int \frac {\cot ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx &=\frac {\operatorname {Subst}\left (\int \frac {1}{x^2 \left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {\cot (e+f x)}{a f}+\frac {\operatorname {Subst}\left (\int \frac {-a-b-b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{a f}\\ &=-\frac {\cot (e+f x)}{a f}-\frac {\operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{(a-b) f}+\frac {b^2 \operatorname {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{a (a-b) f}\\ &=-\frac {x}{a-b}+\frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{a^{3/2} (a-b) f}-\frac {\cot (e+f x)}{a f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.26, size = 68, normalized size = 1.06 \[ \frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )-\sqrt {a} ((a-b) \cot (e+f x)+a (e+f x))}{a^{3/2} f (a-b)} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]^2/(a + b*Tan[e + f*x]^2),x]

[Out]

(b^(3/2)*ArcTan[(Sqrt[b]*Tan[e + f*x])/Sqrt[a]] - Sqrt[a]*(a*(e + f*x) + (a - b)*Cot[e + f*x]))/(a^(3/2)*(a -
b)*f)

________________________________________________________________________________________

fricas [A]  time = 0.47, size = 243, normalized size = 3.80 \[ \left [-\frac {4 \, a f x \tan \left (f x + e\right ) + b \sqrt {-\frac {b}{a}} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} - 4 \, {\left (a b \tan \left (f x + e\right )^{3} - a^{2} \tan \left (f x + e\right )\right )} \sqrt {-\frac {b}{a}}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right ) \tan \left (f x + e\right ) + 4 \, a - 4 \, b}{4 \, {\left (a^{2} - a b\right )} f \tan \left (f x + e\right )}, -\frac {2 \, a f x \tan \left (f x + e\right ) - b \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt {\frac {b}{a}}}{2 \, b \tan \left (f x + e\right )}\right ) \tan \left (f x + e\right ) + 2 \, a - 2 \, b}{2 \, {\left (a^{2} - a b\right )} f \tan \left (f x + e\right )}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

[-1/4*(4*a*f*x*tan(f*x + e) + b*sqrt(-b/a)*log((b^2*tan(f*x + e)^4 - 6*a*b*tan(f*x + e)^2 + a^2 - 4*(a*b*tan(f
*x + e)^3 - a^2*tan(f*x + e))*sqrt(-b/a))/(b^2*tan(f*x + e)^4 + 2*a*b*tan(f*x + e)^2 + a^2))*tan(f*x + e) + 4*
a - 4*b)/((a^2 - a*b)*f*tan(f*x + e)), -1/2*(2*a*f*x*tan(f*x + e) - b*sqrt(b/a)*arctan(1/2*(b*tan(f*x + e)^2 -
 a)*sqrt(b/a)/(b*tan(f*x + e)))*tan(f*x + e) + 2*a - 2*b)/((a^2 - a*b)*f*tan(f*x + e))]

________________________________________________________________________________________

giac [A]  time = 2.48, size = 86, normalized size = 1.34 \[ \frac {\frac {{\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (b) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )\right )} b^{2}}{{\left (a^{2} - a b\right )} \sqrt {a b}} - \frac {f x + e}{a - b} - \frac {1}{a \tan \left (f x + e\right )}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

((pi*floor((f*x + e)/pi + 1/2)*sgn(b) + arctan(b*tan(f*x + e)/sqrt(a*b)))*b^2/((a^2 - a*b)*sqrt(a*b)) - (f*x +
 e)/(a - b) - 1/(a*tan(f*x + e)))/f

________________________________________________________________________________________

maple [A]  time = 0.61, size = 73, normalized size = 1.14 \[ \frac {b^{2} \arctan \left (\frac {\tan \left (f x +e \right ) b}{\sqrt {a b}}\right )}{f a \left (a -b \right ) \sqrt {a b}}-\frac {1}{f a \tan \left (f x +e \right )}-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{f \left (a -b \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)^2/(a+b*tan(f*x+e)^2),x)

[Out]

1/f/a*b^2/(a-b)/(a*b)^(1/2)*arctan(tan(f*x+e)*b/(a*b)^(1/2))-1/f/a/tan(f*x+e)-1/f/(a-b)*arctan(tan(f*x+e))

________________________________________________________________________________________

maxima [A]  time = 1.07, size = 65, normalized size = 1.02 \[ \frac {\frac {b^{2} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{{\left (a^{2} - a b\right )} \sqrt {a b}} - \frac {f x + e}{a - b} - \frac {1}{a \tan \left (f x + e\right )}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)^2/(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

(b^2*arctan(b*tan(f*x + e)/sqrt(a*b))/((a^2 - a*b)*sqrt(a*b)) - (f*x + e)/(a - b) - 1/(a*tan(f*x + e)))/f

________________________________________________________________________________________

mupad [B]  time = 11.77, size = 438, normalized size = 6.84 \[ \frac {a^2\,b-a^3}{f\,\left (a^4\,\mathrm {tan}\left (e+f\,x\right )-a^3\,b\,\mathrm {tan}\left (e+f\,x\right )\right )}+\frac {\mathrm {atan}\left (\frac {a^6\,b\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^3}\,1{}\mathrm {i}-a^3\,b^4\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^3}\,1{}\mathrm {i}}{a^5\,b^5-a^8\,b^2}\right )\,\sqrt {-a^3\,b^3}\,1{}\mathrm {i}-a^3\,\mathrm {atan}\left (\frac {\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,a^5\,b^3+2\,a^3\,b^5\right )+\frac {\left (4\,a^5\,b^4-4\,a^4\,b^5+4\,a^6\,b^3-4\,a^7\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (8\,a^8\,b^2-8\,a^7\,b^3-8\,a^6\,b^4+8\,a^5\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}{2\,a-2\,b}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,a^5\,b^3+2\,a^3\,b^5\right )+\frac {\left (4\,a^4\,b^5-4\,a^5\,b^4-4\,a^6\,b^3+4\,a^7\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (8\,a^8\,b^2-8\,a^7\,b^3-8\,a^6\,b^4+8\,a^5\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}{2\,a-2\,b}}{2\,a^5\,b^2+2\,a^4\,b^3+2\,a^3\,b^4}\right )}{f\,\left (a^3\,b-a^4\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(e + f*x)^2/(a + b*tan(e + f*x)^2),x)

[Out]

(a^2*b - a^3)/(f*(a^4*tan(e + f*x) - a^3*b*tan(e + f*x))) + (atan((a^6*b*tan(e + f*x)*(-a^3*b^3)^(1/2)*1i - a^
3*b^4*tan(e + f*x)*(-a^3*b^3)^(1/2)*1i)/(a^5*b^5 - a^8*b^2))*(-a^3*b^3)^(1/2)*1i - a^3*atan(((((4*a^5*b^4 - 4*
a^4*b^5 + 4*a^6*b^3 - 4*a^7*b^2 + (tan(e + f*x)*(8*a^5*b^5 - 8*a^6*b^4 - 8*a^7*b^3 + 8*a^8*b^2)*1i)/(2*a - 2*b
))*1i)/(2*a - 2*b) + tan(e + f*x)*(2*a^3*b^5 + 2*a^5*b^3))/(2*a - 2*b) + (((4*a^4*b^5 - 4*a^5*b^4 - 4*a^6*b^3
+ 4*a^7*b^2 + (tan(e + f*x)*(8*a^5*b^5 - 8*a^6*b^4 - 8*a^7*b^3 + 8*a^8*b^2)*1i)/(2*a - 2*b))*1i)/(2*a - 2*b) +
 tan(e + f*x)*(2*a^3*b^5 + 2*a^5*b^3))/(2*a - 2*b))/(2*a^3*b^4 + 2*a^4*b^3 + 2*a^5*b^2)))/(f*(a^3*b - a^4))

________________________________________________________________________________________

sympy [A]  time = 14.92, size = 570, normalized size = 8.91 \[ \begin {cases} \tilde {\infty } x & \text {for}\: a = 0 \wedge b = 0 \wedge e = 0 \wedge f = 0 \\\frac {x + \frac {1}{f \tan {\left (e + f x \right )}} - \frac {1}{3 f \tan ^{3}{\left (e + f x \right )}}}{b} & \text {for}\: a = 0 \\- \frac {3 f x \tan ^{3}{\left (e + f x \right )}}{2 b f \tan ^{3}{\left (e + f x \right )} + 2 b f \tan {\left (e + f x \right )}} - \frac {3 f x \tan {\left (e + f x \right )}}{2 b f \tan ^{3}{\left (e + f x \right )} + 2 b f \tan {\left (e + f x \right )}} - \frac {3 \tan ^{2}{\left (e + f x \right )}}{2 b f \tan ^{3}{\left (e + f x \right )} + 2 b f \tan {\left (e + f x \right )}} - \frac {2}{2 b f \tan ^{3}{\left (e + f x \right )} + 2 b f \tan {\left (e + f x \right )}} & \text {for}\: a = b \\\frac {\tilde {\infty } x}{a} & \text {for}\: e = - f x \\\frac {x \cot ^{2}{\relax (e )}}{a + b \tan ^{2}{\relax (e )}} & \text {for}\: f = 0 \\\frac {- x - \frac {\cot {\left (e + f x \right )}}{f}}{a} & \text {for}\: b = 0 \\- \frac {2 i a^{\frac {3}{2}} f x \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )}}{2 i a^{\frac {5}{2}} f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )} - 2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )}} - \frac {2 i a^{\frac {3}{2}} \sqrt {\frac {1}{b}}}{2 i a^{\frac {5}{2}} f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )} - 2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )}} + \frac {2 i \sqrt {a} b \sqrt {\frac {1}{b}}}{2 i a^{\frac {5}{2}} f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )} - 2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )}} + \frac {b \log {\left (- i \sqrt {a} \sqrt {\frac {1}{b}} + \tan {\left (e + f x \right )} \right )} \tan {\left (e + f x \right )}}{2 i a^{\frac {5}{2}} f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )} - 2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )}} - \frac {b \log {\left (i \sqrt {a} \sqrt {\frac {1}{b}} + \tan {\left (e + f x \right )} \right )} \tan {\left (e + f x \right )}}{2 i a^{\frac {5}{2}} f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )} - 2 i a^{\frac {3}{2}} b f \sqrt {\frac {1}{b}} \tan {\left (e + f x \right )}} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)**2/(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0) & Eq(e, 0) & Eq(f, 0)), ((x + 1/(f*tan(e + f*x)) - 1/(3*f*tan(e + f*x)**
3))/b, Eq(a, 0)), (-3*f*x*tan(e + f*x)**3/(2*b*f*tan(e + f*x)**3 + 2*b*f*tan(e + f*x)) - 3*f*x*tan(e + f*x)/(2
*b*f*tan(e + f*x)**3 + 2*b*f*tan(e + f*x)) - 3*tan(e + f*x)**2/(2*b*f*tan(e + f*x)**3 + 2*b*f*tan(e + f*x)) -
2/(2*b*f*tan(e + f*x)**3 + 2*b*f*tan(e + f*x)), Eq(a, b)), (zoo*x/a, Eq(e, -f*x)), (x*cot(e)**2/(a + b*tan(e)*
*2), Eq(f, 0)), ((-x - cot(e + f*x)/f)/a, Eq(b, 0)), (-2*I*a**(3/2)*f*x*sqrt(1/b)*tan(e + f*x)/(2*I*a**(5/2)*f
*sqrt(1/b)*tan(e + f*x) - 2*I*a**(3/2)*b*f*sqrt(1/b)*tan(e + f*x)) - 2*I*a**(3/2)*sqrt(1/b)/(2*I*a**(5/2)*f*sq
rt(1/b)*tan(e + f*x) - 2*I*a**(3/2)*b*f*sqrt(1/b)*tan(e + f*x)) + 2*I*sqrt(a)*b*sqrt(1/b)/(2*I*a**(5/2)*f*sqrt
(1/b)*tan(e + f*x) - 2*I*a**(3/2)*b*f*sqrt(1/b)*tan(e + f*x)) + b*log(-I*sqrt(a)*sqrt(1/b) + tan(e + f*x))*tan
(e + f*x)/(2*I*a**(5/2)*f*sqrt(1/b)*tan(e + f*x) - 2*I*a**(3/2)*b*f*sqrt(1/b)*tan(e + f*x)) - b*log(I*sqrt(a)*
sqrt(1/b) + tan(e + f*x))*tan(e + f*x)/(2*I*a**(5/2)*f*sqrt(1/b)*tan(e + f*x) - 2*I*a**(3/2)*b*f*sqrt(1/b)*tan
(e + f*x)), True))

________________________________________________________________________________________